<!doctype html>
<html>

<head>
    <title>OAuth Demo with bootstrap</title>
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <style type="text/css">
        [ng\:cloak],
        [ng-cloak],
        [data-ng-cloak],
        [x-ng-cloak],
        .ng-cloak,
        .x-ng-cloak {
            display: none !important;
        }
    </style>
</head>

<body data-ng-app="oauthApp">
    <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
        <div data-ng-controller="navigationCtrl" class="container-fluid" data-ng-cloak>
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="index.html">Micro-services using Spring Cloud</a>
            </div>
            <div id="navbar" class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <li><a href="#/">Home</a></li>
                    <!-- The "/login" endpoint that this goes to is handled by Spring Security and if the user 
                        is not authenticated it will result in a redirect to the authorization server. 
                        Note that it is not an Angular # route.
                    -->
                    <li>
                        <a href="login">
                            <span data-ng-switch on="userAuthenticated">
                                <span data-ng-switch-when="true">
                                    Refresh Token
                                </span>
                                        <span data-ng-switch-when="false">
                                    login
                                </span>
                                        <span data-ng-switch-default>
                                    Default login
                                </span>
                            </span>
                        </a>
                    </li>
                    <li><a href="#/user">User</a></li>
                    <li><a href="#/task">Task</a></li>
                    <!-- The "/logout" endpoint is used for Spring security to logout the current user after a 
                    POST request. However when you click on the "login" link again, you don't need to go through
                    the authentication and approval flow; this is because we have only logged out from the "api-gateway" 
                    but not from the authorization server.
                    -->
                    <li data-ng-show="userAuthenticated"><a href="" data-ng-click="logout()">Logout</a></li>
                </ul>
            </div>
            <!--/.nav-collapse -->
        </div>
    </nav>

    <div class="container">
        <div data-ng-view></div>
    </div>

    <script type="text/javascript" src="js/libs/angular.min.js"></script>
    <script type="text/javascript" src="js/libs/angular-route.min.js"></script>
    <!-- note jquery tag has to go before boostrap -->
    <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/app/oauthapp.js"></script>
    <script type="text/javascript" src="js/app/controller/userController.js"></script>
    <script type="text/javascript" src="js/app/controller/navController.js"></script>
    <script type="text/javascript" src="js/app/controller/homeController.js"></script>
    <script type="text/javascript" src="js/app/controller/taskController.js"></script>
    <script type="text/javascript" src="js/app/services/dataservice.js"></script>
</body>

</html>